import ViewMoreText from 'react-native-view-more-text'
import React, { PureComponent } from 'react'
import { View, Text } from 'react-native'

export default class extends PureComponent {
  renderViewMore = (onPress) => {
    return(
      <Text style={{color: 'blue', textDecorationLine: 'underline'}} onPress={onPress}>展开</Text>
    )
  }
  renderViewLess = (onPress) => {
    return(
      <Text style={{color: 'blue', textDecorationLine: 'underline'}} onPress={onPress}>收起</Text>
    )
  }
  render() {
    return (
      <ViewMoreText
        numberOfLines={3}
        renderViewMore={this.renderViewMore}
        renderViewLess={this.renderViewLess}
      >
        <Text>{this.props.children}</Text>
      </ViewMoreText>
    )
  }
}
